<template>
	<view class="fund">
		<view class="head" :style="{height: pHeight + tHeight + 'px'}">
			<view class="xztitle" :style="[{height: pHeight + 'px', top: tHeight + 'px',lineHeight: pHeight + 'px'}]">
				账单详情
				<view class="iconfont icon-dayuhao1" @click="fanhui"></view>
			</view>
		</view>
		<view class="headtop clearfix" :style="{marginTop: pHeight + tHeight + 'px'}"></view>
		<view class="nr">
			<view class="list">
				<view class="liebiao clearfix">
					<view class="left fl">账单号：</view>
					<view class="right fl">
						<view class="title">{{danhao}}</view>
					</view>
				</view>
				<view class="liebiao clearfix">
					<view class="left fl">账单类型：</view>
					<view class="right fl">
						<view class="name" v-if="pingtai == 0">微信-订单收入</view>
						<view class="name" v-if="pingtai == 1">支付宝-订单收入</view>
					</view>
				</view>
				<view class="liebiao clearfix">
					<view class="left fl">账单金额：</view>
					<view class="right fl">
						<view class="title">{{money}}元</view>
					</view>
				</view>
				<view class="liebiao clearfix">
					<view class="left fl">分成金额：</view>
					<view class="right fl">
						<view class="title" v-if="role_id == 1">+{{platform_money}}元</view>
						<view class="title" v-if="role_id == 11">+{{agent_money}}元</view>
						<view class="title" v-if="role_id == 12">+{{bussiness_money}}元</view>
						<view class="title" v-if="role_id == 13">+{{yuangong_money}}元</view>
					</view>
				</view>
				<view class="liebiao clearfix">
					<view class="left fl">账单时间：</view>
					<view class="right fl">
						<view class="title">{{create_time}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseUrl: getApp().globalData.baseUrl,
				headerTop: 0,
				pHeight: 0,
				tHeight: 0,
				id: '',
				danhao: '',
				pingtai: '',
				role_id: uni.getStorageSync('role_id'),
				money: '',
				platform_money: '',
				agent_money: '',
				bussiness_money: '',
				yuangong_money: '',
				create_time: '',
			}
		},
		onLoad(options) {
			// 头部距离
			let res = uni.getSystemInfoSync() ///微信api方法
			let titleH;
			if (res && res['system']) {
				// 判断是否是安卓操作系统 （标题栏苹果为44px,安卓为48px）
				if (res['system'].indexOf('Android') > 0) {
					titleH = 48
				} else {
					titleH = 46
				}
				this.headerTop = titleH + res['statusBarHeight']
				this.pHeight = titleH
				this.tHeight = res['statusBarHeight']
			}
			
			this.id = options.id;
			
			this.request({
				url: '/orderx/detail',
				data: {
					id: this.id,
				},
				method: "POST"
			}).then(res => {
				if (res.data.code == 200) {
					this.money = res.data.data.money;
					this.danhao = res.data.data.danhao;
					this.pingtai = res.data.data.pingtai;
					this.platform_money = res.data.data.platform_money;
					this.agent_money = res.data.data.agent_money;
					this.bussiness_money = res.data.data.bussiness_money;
					this.yuangong_money = res.data.data.yuangong_money;
					this.create_time = res.data.data.create_time;
				} else {
					uni.showToast({
						title: '请求失败，请稍后再试',
						icon: 'none'
					})
				}
			})
		},
		methods: {
			fanhui() {
				uni.navigateBack();
			}
		}
	}
</script>

<style lang="scss" scoped>
	.fund {
		width: 100%;
		margin: 0 auto;
		height: 100vh;
		background: #f9f9ff;
		overflow-y: scroll;

		.head {
			width: 100%;
			position: fixed;
			top: 0;
			left: 0;
			z-index: 99;
			background: linear-gradient(90deg, #f9f9ff, #d4e8ff);

			.xztitle {
				position: fixed;
				left: 0%;
				top: 0;
				width: 100%;
				text-align: left;
				color: #333333;
				font-size: 32rpx;
				padding-left: 74rpx;
				font-weight: 700;

				.iconfont {
					position: absolute;
					top: 0;
					left: 30rpx;
					font-size: 44rpx;
				}
			}
		}

		.headtop {
			width: 100%;
			background: linear-gradient(90deg, #f9f9ff, #d4e8ff);
			height: 300rpx;
			padding: 20rpx 40rpx 0;
			box-sizing: border-box;
		}
		
		.nr{
			width: 90%;
			margin: 0 auto;
			z-index: 70;
			margin-top: -280rpx;
			box-shadow: rgba(223, 230, 255, 0.67) 0px 0px 6px;
			
			.list{
				width: 100%;
				background: #fff;
				border-radius: 20rpx;
				margin-bottom: 20rpx;
				padding: 40rpx 40rpx 10rpx;
				position: relative;
				
				.liebiao{
					margin-bottom: 30rpx;
					
					.left{
						font-size: 24rpx;
						color: #333333;
						width: 30%;
					}
					
					.right{
						
						.title{
							font-size: 24rpx;
							color: #333333;
						}
						
						.name{
							font-size: 24rpx;
							color: #5C88FA;
						}
					}
				}
			}
		}
	}
</style>